package com.mls.fivedistrict.pojo;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * <p>
 * </p>
 *
 * @author Five Team
 * @since 2018-06-04
 */
@Data
@Accessors(chain = true)
@TableName(value = "t_user_message",resultMap = "BaseResultMap")
public class UserMessage extends Model<UserMessage> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 发送者用户ID
     */
    @NotNull(message = "发送者id不能为空")
    private Long userId;
    /**
     * 目标用户ID  官方用户ID为0
     */
    @NotNull(message = "目标用户id不能为空")
    private Long targetUserId;
    /**
     * 发送的消息
     */
    @NotBlank(message = "发送的消息不能为空")
    private String message;
    /**
     * 消息回复时的原始消息ID
     */
    private Long messageId;
    private Date createDate;
    private Date update;
    @TableLogic
    private boolean isDelete;

    private boolean isRead;
    /**
     * 查看时间
     */
    private Date viewDate;

    private transient User user;
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
